package com.nf.health.app.widget;

import com.github.mikephil.charting.components.AxisBase;
import com.github.mikephil.charting.formatter.IAxisValueFormatter;
import com.nf.health.app.models.Result;

import java.util.List;

/**
 * Created by changpeng on 2017/6/6 0006.
 */

public class MyPhysiqueBarChatXAxisFormatter implements IAxisValueFormatter {

    private final List<Result.EvalBean.EvalArrayBean> array;

    public MyPhysiqueBarChatXAxisFormatter(List<Result.EvalBean.EvalArrayBean> array) {
        this.array = array;
    }

    @Override
    public String getFormattedValue(float value, AxisBase axis) {
        int valueI = (int) value;
//        if(value == 1){
//            return "平和质";
//        }else if(valueI == 2){
//            return "阴虚质";
//        }else if(valueI == 3){
//            return "气郁质";
//        }else if(valueI == 4){
//            return "气虚质";
//        }else if(valueI == 5){
//            return "特禀质";
//        }else if(valueI == 6){
//            return "阳虚质";
//        }else if(valueI == 7){
//            return "痰湿质";
//        }else if(valueI == 8){
//            return "血瘀质";
//        }else if(valueI == 9){
//            return "湿热质";
//        }

        if(value == 1){
            return array.get(0).getType();
        }else if(valueI == 2){
            return array.get(1).getType();
        }else if(valueI == 3){
            return array.get(2).getType();
        }else if(valueI == 4){
            return array.get(3).getType();
        }else if(valueI == 5){
            return array.get(4).getType();
        }else if(valueI == 6){
            return array.get(5).getType();
        }else if(valueI == 7){
            return array.get(6).getType();
        }else if(valueI == 8){
            return array.get(7).getType();
        }else if(valueI == 9){
            return array.get(8).getType();
        }
        return value+"";
    }

    @Override
    public int getDecimalDigits() {
        return -1;
    }
}
